﻿
@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_Form.cshtml";
}

<script>
    var from = $.request("from");
    var organizeId = $.request("organizeId");
    var isContansChildOrg = $.request("isContansChildOrg");
    var keyValue = $.request("keyValue");
    var isShowEmpty = $.request("isShowEmpty");
    var isExpand = $.request("isExpand");
    var callbackType = $.request("callbackType");
    var single = $.request("single");
    var fromDialog = $.request("fromDialog");
    $(function () {
        initControl();
    })
    function initControl() {
        $("#userStaffTree").treeview({
            height: 400,
            slimscroll: false,
            showcheck: true,
            url: "/User/GetSysUserSelectorTree",
            param: { from: from, organizeId: organizeId, isContansChildOrg: isContansChildOrg, keyValue: keyValue, isShowEmpty: isShowEmpty, isExpand: isExpand }
        });
    }
    function submitForm() {
        var treeSeleData;
        if (callbackType == 'json') {
            treeSeleData = $("#userStaffTree").getCheckedNodeObjArray();
            if (single == 'true' && treeSeleData.length != 1) {
                $.modalAlert('最多选中一条', 'warning');
                return;
            }
        }
        else {
            treeSeleData = $("#userStaffTree").getCheckedValues();  //Values对应的UserId/
            if (single == 'true' && treeSeleData.length != 1) {
                $.modalAlert('最多选中一条', 'warning');
                return;
            }
            treeSeleData = String(treeSeleData);
        }

        if (false) {

        }
        else if (fromDialog) {
            //默认行为，callback上一Dialog的方法
            top.top.window.frames[fromDialog].userStaffTreeCallback(treeSeleData);
        }
        else {
            //默认行为，callback上一页面的方法
            $.currentWindow().window.userStaffTreeCallback(treeSeleData);
        }
    }
</script>
<form id="form1">
    <div class="widget-body">
        <div id="userStaffTree"></div>
    </div>
</form>


